<template>
    <div class="box">
        <div class="header" v-if="list.rows">
            <p style="text-align:center;font-size:18px;font-weight:600;width:100%">门店销售统计报表</p>
            <!-- <div>{{list.rows}}</div> -->
            <div class="content">
                <Table border :columns="columns1" :data="list.rows" class="table" :height="(list.rows.length+1)*45"></Table>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    props: {
        dataArr: {
            type: Object,
            default() {
                return {}
            }
        }
    },
    data() {
        return {
            list: {},
            columns1: [
                // {
                //     title: '单号',
                //     key: 'PayNum',
                //     width: 110,
                //     align: 'center'
                // },
                {
                    title: '日期',
                    width: 70,
                    align: 'center',
                    render: (h, params) => {
                        const { CreateTime } = params.row
                        return h('div', [
                            h('p', {}),
                            CreateTime.substring(0, 10)
                        ])
                    }
                },
                {
                    title: '药品名称',
                    key: 'PName'
                    // align: 'center'
                },
                {
                    title: '规格',
                    key: 'PSName',
                    width: 100
                    // align: 'center'
                },
                {
                    title: '生产厂家',
                    key: 'FactoryShortName',
                    width: 100
                    // align: 'center'
                },
                // {
                //     title: '付款方式',
                //     key: 'Dname',
                //     width: 50,
                //     align: 'center'
                // },
                {
                    title: '单位',
                    key: 'Unit',
                    width: 40,
                    align: 'center'
                },
                {
                    title: '数量',
                    key: 'PCount',
                    width: 40,
                    align: 'center'
                },
                {
                    title: '进价',
                    key: 'Cost',
                    width: 40,
                    align: 'center'
                },
                {
                    title: '进额',
                    key: 'TotalCost',
                    width: 40,
                    align: 'center'
                },

                {
                    title: '零价',
                    key: 'Price',
                    width: 40,
                    align: 'center'
                },
                {
                    title: '零额',
                    key: 'TotalPrice',
                    width: 40,
                    align: 'center'
                },

                {
                    title: '差额',
                    key: 'Profit',
                    width: 40,
                    align: 'center'
                }
            ]
        }
    },
    mounted() {
        this.list = this.dataArr
        this.list.rows.push({
            CreateTime: '合计',
            PName: '',
            PSName: '',
            FactoryShortName: '',
            Dname: '',
            Unit: '',
            PCount: '',
            Cost: '',
            TotalCost: this.list.AllCost,
            Price: '',
            TotalPrice: this.list.AllPrice,
            Profit: this.list.AllProfit
        })
    },
    methods: {}
}
</script>
<style lang='less' scoped >
.box {
    /* background: #ccc; */
    width: 800px;
    margin: 0 auto;
    font-size: 12px !important;
}
.header {
    width: 100%;
}
.content {
    margin: 0 auto;
    margin-top: 40px;
}
.footer {
    margin-top: 20px;
    font-size: 14px;
}
.tableHead {
    font-size: 12px !important;
}
.ivu-table-cell {
    font-size: 12px !important;
    padding: 0 !important;
}
</style>
<style scoped >
.content >>> .ivu-table-cell {
    font-size: 12px !important;
    padding: 0 !important;
}
</style>
